package classes.fire {
	import flash.display.MovieClip;
	import flash.utils.getDefinitionByName;

	import com.mttang.common.InterfaceCommon;
	import classes.GameSetting;

	/**
	 * ...
	 * @author fox
	 */
	public class ManPetLayer extends MovieClip implements InterfaceCommon {

		private var _saveData:Object; //共享对象
		private var _man:* //人物
		private var _petArr:Array = new Array(); //宠物数组


		public function ManPetLayer(){
		}

		public function rock_pause():void //所有场景可以暂停/播放；
		{
		}

		public function rock_play():void //
		{
		}

		public function rock_close():void //关闭清除当前的场景;swf文件的声音，flv在这里清除;
		{
		}

		public function cfgSound(status:String):void //控制声音;	
		{
		}

		public function setData(_data:Object):void //所有的场景通过这个接口获取数据对象;
		{
			_saveData = _data;
			//layout man
			layoutMan();
			//layout pet
			layoutPet();
		}

		private function layoutMan():void {
			var _manCls:Class = getDefinitionByName(_saveData.user.manid) as Class;
			_man = new _manCls();
			_man.scaleX = 0.4;
			_man.scaleY = 0.4;
			addChildAt(_man, numChildren);
			_man.x = GameSetting.stageWidth / 2-_man.width;
			_man.y = GameSetting.OFFSETY-_man.height/2;
		}

		private function layoutPet():void {
			for (var i:int = 0; i < _saveData.pet.length; i++){
				if (_saveData.pet[i].status==1&&_saveData.pet[i].level!=0) {
					_petArr.push(_saveData.pet[i]);
				}
			}
			if (_petArr) {
				trace("show pet");
			}else {
				trace("no pet");
			}
		}


	/*******************************************************************************************/
	}
}